s=input()
arr=s.split(' ')
arr.sort()
der=0
maxa=-1
len1=0
for i in range(1,len(arr)):
    if arr[i]==arr[i-1] :
        len1+=1
    else:
        if len1>maxa:
            der=arr[i-1]
            maxa=len1
        len1=1
if len1>maxa:
    der=arr[len(arr)-1]
    maxa=len1
    len1=1
print(der,maxa)